package io.gitee.wminyu.day03.Sort;

import java.util.Arrays;
import java.util.Scanner;

public class Insertion_sort {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int m = input.nextInt();
        int arrays[] = new int[m];
        for (int i = 0; i < m; i++) {
            arrays[i] = input.nextInt();
        }
        System.out.println("原数组为：" + Arrays.toString(arrays));
    }
    //插入排序
    public static void Insertion(int[]a){
        int i,j,temp;
        for (i=1;i<a.length;i++){
            temp = a[i];
            j=i-1;
            while (j>=0&&temp<a[j]){
                a[j+1] = a[j];
                j--;
            }
            a[j+1]=temp;
            System.out.print("第"+i+"趟排序为：");
            Display(a);
            System.out.println();
        }System.out.println("最终排序为："+Arrays.toString(a));
    }
    public static void Display(int[] a){
        for (int i=0;i<a.length;i++){

            System.out.print(a[i]+" ");
        }
    }
}
